﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test06
{
    class Program
    {
        //6.打印杨辉三角形（10行）。
        static void Main(string[] args)
        {
            int i, j,k;
            int[,] a = new int[10, 10];
            for (i=0;i<10;i++)
            {
                a[i, 0] = 1;
                a[i, i] = 1;
            }
            for (i=2;i<10;i++)
            {
                for (j = 1; j < i; j++)
                    a[i, j] = a[i - 1, j - 1] + a[i - 1, j];
            }
            for (i=0;i<10;i++)
            {
                for (j = 0; j <= i; j++)
                    Console.Write(a[i, j].ToString()+" ");
                Console.WriteLine();
            }
            Console.ReadKey();
        }
    }
}
